<h2>
    <?php echo $this->__('Forum')?>
    [<a href="<?php echo $this->url(array(), 'forumrss') ?>"><?php echo $this->__('rss'); ?></a>]
</h2>
<table>
  <thead>
    <tr>
      <th><?php echo $this->__('Category')?></th>
      <th width="170"><?php echo $this->__('Last post')?></th>
      <th width="60"><?php echo $this->__('Posts')?></th>
      <th width="60"><?php echo $this->__('Comments')?></th>
      <th width="60"><?php echo $this->__('Views')?></th>
    </tr>
  </thead>
  <tbody>
    <?php if ($this->categories->count()): ?>
        <?php foreach($this->categories as $row): ?>
            <tr class="category category-level-<?php echo $row->level?>">
              <td>
                <h4>
                    <a href="<?php echo $this->url(array('alias'=> $row->alias), 'forumcategory')?>"><?php echo $row->title?></a>
                    [<a href="<?php echo $this->url(array('alias'=> $row->alias), 'forumcategoryrss') ?>"><?php echo $this->__('rss'); ?></a>]
                </h4>
                <div><?php echo $row->description?></div>
              </td>
              <td>
                  <?php $post = isset($this->posts[$row->id])?$this->posts[$row->id]:null;?>

                  <?php if ($post):?>
                      <h5>
                        <a href="<?php echo $this->url(array('id'=> $post->id), 'forumpost')?>" title="<?php echo $post->getTeaser()?>">
                          <?php echo $post->title?>
                        </a>
                      </h5>
                      <div class="right">
                          <?php echo $this->__('by')?> <?php echo $post->login?>
                          <?php echo $this->__('at')?> <span><?php echo $this->date($post->created)?></span>
                      </div>
                  <?php else:?>
                    <center><?php echo $this->__('No Posts Yet')?></center>
                  <?php endif;?>
              </td>
              <td align="center"><?php echo ($post) ? $post->postsCount : 0?></td>
              <td align="center"><?php echo ($post) ? $post->commentsCount : 0?></td>
              <td align="center"><?php echo ($post) ? $post->viewsCount : 0?></td>
            </tr>
        <?php endforeach;?>
    <?php else: ?>
        <tr>
            <th colspan="5"><h1><?php echo $this->__('No Categories Yet')?></h1></th>
        </tr>
    <?php endif; ?>
  </tbody>
</table>